package com.mall.server.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.commons.utils.PageUtils;
import com.mall.dubbo.api.CmsSubjectApi;
import com.tanhua.model.domain.CmsSubject;
import com.tanhua.model.vo.PageVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SubjectService {

    @DubboReference
    private CmsSubjectApi cmsSubjectApi;

    /**
     * 获取全部商品专题
     * @return
     */
    public List<CmsSubject> listAll() {
        return cmsSubjectApi.listAll();
    }

    /**
     * 根据专题名称分页获取商品专题
     * @param keyword
     * @param page
     * @return
     */
    public PageVo subjectList(String keyword, Page<CmsSubject> page) {
        Page result =cmsSubjectApi.subjectList(keyword,page);
        return PageUtils.getPageVo(result);
    }
}
